<?php
class MensajesJBPM{
	public function invocar($parametros,$accion,$endPoint,$uri,$style=SOAP_RPC,$use=SOAP_LITERAL){
		$String_1=htmlspecialchars($this->crearMensaje($parametros));
		$salida=0;
		$SoapSettings = array(
 			  "location" => $endPoint,
 			  "uri" => $uri,
 			  "style" => $style,
 			  "use" => $use);
		$cliente=new SoapClient(NULL,$SoapSettings);
		try {	

			$resultObject = $cliente->__soapCall($accion,array(new SoapParam($String_1,"arg0")));
			$salida= $resultObject;

			} catch (SoapFault $exception) {
				 throw new Exception($exception);
			}//try-catch
		return $salida;
	}
	private function crearMensaje($parametros){
		$salida="<message><properties>";
		try{
			foreach($parametros as $clave => $value){
				if(is_numeric($clave))
					$clave="param_".$clave;
				$salida.="<property>
						<name>{$clave}</name>
						<value class=\"string\">{$value}</value>
					  </property>";

			}
		}catch(Exception $e){	
			print $e->getMessage();		
		}
		$salida.="</properties></message>";
		return $salida;	
	}
	

}

$WebServiceURL = 'http://172.16.1.55:8080/jbpm-services-jbpm-services/JBPMServices';
$uri="http://services.jbpm/";
			
			
?>
